﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dbPoll_Application.ViewModels.ParticipantFieldViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	EditGroup
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="../../Scripts/EditParticipant.js"></script>
<div class="pageHeadingContainer"><h2 class="pageHeading">Add Members - <%=Model.group.name %></h2></div>
    <p>
        <%= Html.ActionLink("Polls > ", "Index", "Poll", null, new { @class = "breadcrumb" })%><%= Model.poll.name %></p>
    Tick the participants you want to add.
    <% using (Html.BeginForm("Details", "Participant", new { participantID = Model.group.groupID, pollID = Model.poll.pollID, pollName = Model.poll.name }, FormMethod.Post, new { onsubmit = "return validate();" }))
       { %>
<table class="questions"><thead><tr><th></th><th>Device ID/Username</th>
    <th>Email</th><th>Type of User</th></tr></thead>
    <tbody>
    <% String username;
       foreach (var participant in Model.participants)
       {
           if (participant.type == Model.type("Keypad")) { username = participant.deviceID; }
           else { username = participant.linkedUser.UserName; }
           %><input type="hidden" class="group" name="<%=participant.participantID%>" id="<%=username %>" value="<%=participant.group!=null %>" />
           <tr><td><input type="checkbox" id="<%=participant.participantID %>" name="participants" value="<%=participant.participantID %>" />
           <span id="a<%=participant.participantID %>"></span></td>
           <%if (participant.type == Model.type("Keypad"))
             {%><td><%=username%></td><td></td><td>Keepad User</td><%}
             else
             {%><td><%=username%></td><td><%=participant.linkedUser.Email%></td>
           <td>Web User</td>
         <%}%> 
         </tr>  
    <%}
     %>
     </tbody></table>
     
    <input type="hidden" value="<%= Model.poll.pollID %>" id="Hidden1" name="pollID"/>
    <input type="hidden" value="<%= Model.group.groupID %>" id="participantID" name="participantID" />
    <input type="submit" value="Add Participants" /> <%}%>
</asp:Content>
